/*
 * 文件名：User.java
 * 版权：亚信联创版权所有
 * 描述：TODO
 * 修改人：yuanze
 * 修改时间：2014年10月31日
 * 修改内容：TODO
 */
package com.ailk.bigdata.etl.realstream.server.model;

import io.netty.channel.ChannelHandlerContext;

import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @description 实时流用户管理缓存信息
 * @author [yuanze]
 * @version [版本号,2014年10月31日]
 * @see [相关类/方法]
 * @since [产品/模块版本]
 */
public class RealStreamUser
{
	private String clientIP;// 数据发送方IP
	private String userName;// 用户名
	private String userPwd;// 密码
	private boolean isversionVerify;
	private boolean isLogin = false;// 是否登陆
	private boolean isOpenDataConn = false;// 是否打开数据连接
	private int dataConnPort;// 数据连接端口
	private boolean isSupportAllCalc = false;// 是否支持所有计算规则
	private Set<Long> calcUnitCode = new HashSet<Long>();
	private ChannelHandlerContext ctx;
	private volatile AtomicInteger acceptedDataCount = new AtomicInteger();

	public String getClientIP()
	{
		return clientIP;
	}

	public void setClientIP(String clientIP)
	{
		this.clientIP = clientIP;
	}

	public String getUserName()
	{
		return userName;
	}

	public void setUserName(String userName)
	{
		this.userName = userName;
	}

	public String getUserPwd()
	{
		return userPwd;
	}

	public void setUserPwd(String userPwd)
	{
		this.userPwd = userPwd;
	}

	public boolean isIsversionVerify()
	{
		return isversionVerify;
	}

	public void setIsversionVerify(boolean isversionVerify)
	{
		this.isversionVerify = isversionVerify;
	}

	public boolean isLogin()
	{
		return isLogin;
	}

	public void setLogin(boolean isLogin)
	{
		this.isLogin = isLogin;
	}

	public boolean isOpenDataConn()
	{
		return isOpenDataConn;
	}

	public void setOpenDataConn(boolean isOpenDataConn)
	{
		this.isOpenDataConn = isOpenDataConn;
	}

	public int getDataConnPort()
	{
		return dataConnPort;
	}

	public void setDataConnPort(int dataConnPort)
	{
		this.dataConnPort = dataConnPort;
	}

	public boolean isSupportAllCalc()
	{
		return isSupportAllCalc;
	}

	public void setSupportAllCalc(boolean isSupportAllCalc)
	{
		this.isSupportAllCalc = isSupportAllCalc;
	}

	public Set<Long> getCalcUnitCode()
	{
		return calcUnitCode;
	}

	public void setCalcUnitCode(Set<Long> calcUnitCode)
	{
		this.calcUnitCode = calcUnitCode;
	}

	public ChannelHandlerContext getCtx()
	{
		return ctx;
	}

	public void setCtx(ChannelHandlerContext ctx)
	{
		this.ctx = ctx;
	}

	public int incrementDatasAcceptedCount()
	{
		return acceptedDataCount.incrementAndGet();
	}

	public int getAcceptedAndReset()
	{
		int currentCount = acceptedDataCount.get();
		acceptedDataCount.set(0);
		return currentCount;
	}
}
